package com.amos.exception;

import com.amos.bean.IResult;

/**
 * Copyright © 2018 嘉源锐信. All rights reserved.
 *
 * @Project: mu-exam
 * @ClassName: MuExamException
 * @Package: com.amos.exception
 * @author: zhuqb
 * @Description:
 * @date: 2020/3/24 0024 下午 15:20
 * @Version: V1.0
 */
public class BaseException extends RuntimeException {
    private static final long serialVersionUID = 3524813404100562095L;
    /**
     * 执行的结果
     */
    private IResult result;
    /**
     * 消息定义的参数
     */
    private Object[] args;

    public BaseException(IResult result) {
        super(result.getMsg());
        this.result = result;
    }


    public BaseException(Integer code, String msg) {
        super(msg);
        this.result = new IResult() {
            @Override
            public Integer getCode() {
                return code;
            }

            @Override
            public String getMsg() {
                return msg;
            }
        };
    }

    public BaseException(IResult result, Object[] args, String msg) {
        super(msg);
        this.result = result;
        this.args = args;
    }

    public BaseException(IResult result, Object[] args, String msg, Throwable throwable) {
        super(msg, throwable);
        this.result = result;
        this.args = args;
    }
}
